import type { App } from 'vue'
import InfiniteScroll from 'element-plus'
const modules = import.meta.glob('./modules/*.ts', {
  eager: true,
  import: 'default'
})

const directives = {
  install: function (app: App<Element>) {
    for (const [key, defaultModule] of Object.entries(modules)) {
      if (!defaultModule) return
      const klen = key.length
      app.directive(key.substring(10, klen - 3), defaultModule) // 注册所有自定义指令
    }
    app.use(InfiniteScroll)
  }
}

//在main.ts中引入并app.use()
export default directives
